home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm2 / crshtk10.lha / CrashTick / TickStatsFormat.doc < prev    next >
Text File  |  1996-05-08  |  9KB  |  186 lines

  1.                   CrashTick Statistics file format 1.0
  2.  
  3.                               08-May-96
  4.  
  5. Introduction
  6. ============
  7. In this file, the format of CrashTick's statistics file is described.
  8. With this text and a little programming knowledge, you can easily make
  9. your own programs that use the statistics file. 
  10.  
  11. There are two basic rules that you should obey:
  12.  
  13. 1) Do NOT alter the file!
  14. 2) If the file isn't in the expected format, warn the user and
  15.    quit the program nicely.
  16.  
  17. File format
  18. ===========
  19.  
  20. Basic file format
  21. -----------------
  22.  
  23.  +---------+--------------------------------------------------------+
  24.  | Size    | Description                                            |
  25.  +---------+--------------------------------------------------------+
  26.  | 4 bytes | Always the string "CTS1". These four characters tell   |
  27.  |         | you what kind of file it is. If the these four         |
  28.  |         | characters aren't "CTS1", your program should give an  |
  29.  |         | error and quit nicely.                                 |
  30.  +---------+--------------------------------------------------------+
  31.  | 4 bytes | A longword that contains the day the statistics file   |
  32.  |         | was written. This is stored as days since Jan. 1, 1978 |
  33.  |         | which is the same way AmigaDOS stores the date in      |
  34.  |         | datestamps        .                                    |
  35.  +---------+--------------------------------------------------------+
  36.  | 4 bytes | A longword that tells you how many areas there are in  |
  37.  |         | this file.                                             |
  38.  +---------+--------------------------------------------------------+
  39.  | ???     | The statistics for the areas. The format of these      |
  40.  |         | sections are described below. There are as many        |
  41.  |         | structures as specified with the previous four bytes.  |
  42.  +---------+--------------------------------------------------------+
  43.  | 4 bytes | A longword that tells you how many nodes there are in  |
  44.  |         | this file.                                             |
  45.  +---------+--------------------------------------------------------+
  46.  | ???     | The statistics for the nodes. The format of these      |
  47.  |         | sections are described below. There are as many        |
  48.  |         | structures as specified with the previous four bytes.  |
  49.  +---------+--------------------------------------------------------+
  50.  
  51.  
  52.  
  53. Area statistics format
  54. ----------------------
  55.  
  56.  +-----------+--------------------------------------------------------+
  57.  | Size      | Description                                            |
  58.  +-----------+--------------------------------------------------------+
  59.  | 80 bytes  | The name of the area                                   |
  60.  +-----------+--------------------------------------------------------+
  61.  | 2 bytes   | A word that contains the zone number of the aka        |
  62.  +-----------+--------------------------------------------------------+
  63.  | 2 bytes   | A word that contains the net number of the aka         |
  64.  +-----------+--------------------------------------------------------+
  65.  | 2 bytes   | A word that contains the node number of the aka        |
  66.  +-----------+--------------------------------------------------------+
  67.  | 2 bytes   | A word that contains the point number of the aka       |
  68.  +-----------+--------------------------------------------------------+
  69.  | 1 byte    | The group of the area ("A"-"Z") or zero if no group    |
  70.  |           | is specified for this areas.                           |
  71.  +-----------+--------------------------------------------------------+
  72.  | 1 byte    | Not used. This byte exists to make sure that the next  |
  73.  |           | item is on an even offset in the file to make it       |
  74.  |           | easier to read this file when programming in C         |
  75.  +-----------+--------------------------------------------------------+
  76.  | 4 bytes   | A longword that contains the total number of __files__ |
  77.  |           | you have received in this area.                        |
  78.  +-----------+--------------------------------------------------------+
  79.  | 4 bytes   | A longword that contains the total number of __bytes__ |
  80.  |           | you have received in this area.                        |
  81.  +-----------+--------------------------------------------------------+
  82.  | 8*4 bytes | 8 longwords that contain the number of __files__ that  |
  83.  |           | have arrived in this area for the last 8 days. The     |
  84.  |           | first word contains the number of messages that had    |
  85.  |           | arrived so far the day the file was written, the       |
  86.  |           | second word contains the number of  messages that had  |
  87.  |           | arrived the day before that etc.                       |
  88.  +-----------+--------------------------------------------------------+
  89.  | 8*4 bytes | 8 longwords that contain the number of __bytes__ that  |
  90.  |           | have arrived in this area for the last 8 days. The     |
  91.  |           | first word contains the number of messages that had    |
  92.  |           | arrived so far the day the file was written, the       |
  93.  |           | second word contains the number of  messages that had  |
  94.  |           | arrived the day before that etc.                       |
  95.  +-----------+--------------------------------------------------------+
  96.  | 4 bytes   | A longword that contains the day since Jan. 1, 1978    |
  97.  |           | that you first received messages in this area.         |
  98.  +-----------+--------------------------------------------------------+
  99.  | 4 bytes   | A longword that contains the minutes since midnight    |
  100.  |           | the first time you received messages in this area.     |
  101.  +-----------+--------------------------------------------------------+
  102.  | 4 bytes   | A longword that contains the "ticks" (50 ticks are     |
  103.  |           | one second) since the last whole minute the first time |
  104.  |           | you received messages in this area. The three last     |
  105.  |           | fields together are a normal AmigaDOS datestamp.       |
  106.  +-----------+--------------------------------------------------------+
  107.  | 4 bytes   | A longword that contains the last date you received    |
  108.  |           | messages in this area. This is stored as days since    |
  109.  |           | Jan. 1, 1978 which is the same way AmigaDOS stores the |
  110.  |           | date in datestamps.                                    |
  111.  +-----------+--------------------------------------------------------+
  112.  
  113. Node statistics format
  114. ----------------------
  115.  
  116.  +----------+--------------------------------------------------------+
  117.  | Size     | Description                                            |
  118.  +----------+--------------------------------------------------------+
  119.  | 2 bytes  | A word that contains the zone number of the node       |
  120.  +----------+--------------------------------------------------------+
  121.  | 2 bytes  | A word that contains the net number of the node        |
  122.  +----------+--------------------------------------------------------+
  123.  | 2 bytes  | A word that contains the node number of the node       |
  124.  +----------+--------------------------------------------------------+
  125.  | 2 bytes  | A word that contains the point number of the node      |
  126.  +----------+--------------------------------------------------------+
  127.  | 4 bytes  | A longword that contains the total number of __files__ |
  128.  |          | you have sent to this node.                            |
  129.  +----------+--------------------------------------------------------+
  130.  | 4 bytes  | A longword that contains the total number of __bytes__ |
  131.  |          | you have sent to this node.                            |
  132.  +----------+--------------------------------------------------------+
  133.  | 4 bytes  | A longword that contains the total number of __files__ |
  134.  |          | you have received from this node.                      |
  135.  +----------+--------------------------------------------------------+
  136.  | 4 bytes  | A longword that contains the total number of __bytes__ |
  137.  |          | you have received from this node.                      |
  138.  +----------+--------------------------------------------------------+
  139.  | 4 bytes  | A longword that contains the first date you received   |
  140.  |          | anything from this node or sent anything to this node. |
  141.  |          | This is stored as days since Jan. 1, 1978 which is the |
  142.  |          | same way AmigaDOS stores the date in datestamps.       |
  143.  +----------+--------------------------------------------------------+
  144.  
  145. Structures for C programmers
  146. ============================
  147. Here they are, ready to be used! These are the needed definitions for
  148. uchar, uword and ulong:
  149.  
  150. typedef unsigned char  uchar;    /* must be  8 bits wide */
  151. typedef unsigned short uword;    /* must be 16 bits wide */
  152. typedef unsigned long  ulong;    /* must be 32 bits wide */
  153.  
  154. struct Node4D
  155. {
  156.    uword Zone,Net,Node,Point;
  157. };
  158.  
  159. struct DiskAreaStats
  160. {
  161.    uchar Tagname[80];
  162.    struct Node4D Aka;
  163.  
  164.    uchar Group;
  165.    uchar fill_to_make_even; /* Just ignore this one */
  166.  
  167.    ulong TotalFiles;
  168.    ulong TotalBytes;
  169.    ulong Last8DaysFiles[8];
  170.    ulong Last8DaysBytes[8];
  171.  
  172.    struct DateStamp FirstTime;
  173.    ulong LastDay;
  174. };
  175.  
  176. struct DiskNodeStats
  177. {
  178.    struct Node4D Node;
  179.    ulong SentFiles;
  180.    ulong SentBytes;
  181.    ulong GotFiles;
  182.    ulong GotBytes;
  183.    ulong FirstDay;
  184. };
  185.  
  186.